﻿using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Rhino.Mocks;

namespace WpfApplication6.Model
{
    [TestFixture]
    public class ProductsRepositoryTests
    {
        [Test, Explicit]
        public void GetProductsReturnsCorrectListOfProducts()
        {
            //arrange
            var dbContext = MockRepository.GenerateStub<NorthwindDbContext>();

            dbContext.Stub(x => x.Products.GetEnumerator())
                .Return(new List<ProductItem> {new ProductItem()}.GetEnumerator());

            var repository = new ProductsRepository(dbContext);

            //act
            IEnumerable<ProductItem> products = repository.GetProducts();

            //assert
            Assert.IsTrue(products.Count() == 1);
        }
    }
}